package com.kmxd.ams.core.common.enums;

import com.kmxd.ams.core.common.constant.ErrorCode;
import com.kmxd.ams.core.exception.BizException;
import java.util.Arrays;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 四性检测
 *
 * @author ZuoLG
 */
@Getter
@AllArgsConstructor
public enum SxStatusEnums {
  /** 待检测 */
  UNCHECK(-1, "待检测", "待检测"),
  PASS(1, "已检测（通过）", "通过"),
  IGNORE(2, "默认通过", "人工通过"),
  FAILED(0, "已检测（未通过）", "未通过");

  private final Integer status;
  private final String sxRecordStatus;
  private final String fourCheckResult;

  public static SxStatusEnums convert(Integer status) {
    return Arrays.stream(values())
        .filter(x -> x.status.equals(status))
        .findAny()
        .orElseThrow(() -> BizException.instance(ErrorCode.NOT_FOUND, "未找到指定数据：" + status));
  }
}
